<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>6-改变this指向bind</title>
</head>
<body>
    <script type="text/javascript">
        //setData(2,3);//Window
        var obj = {
            username:'cms'
        };
        //一个旧数组怎么添加到新数组呢？ push concat
        function setData(){
            console.log(this);//Object {username: "cms"}
            console.log(this.username);
        }
        //给函数改变this指向obj
        var x = setData.bind(obj);
        x();//
    </script>
</body>
</html>